<?
/***************************************************
 * 	File : send.php
 * 	@author Hoang Tran (huuhoangbk@gmail.com)
 * 
 * 	Send mail to admin
 ***************************************************/
header("Refresh: 0; url= http://bkiter.net");
include "class.phpmailer.php"; 
include "class.smtp.php"; 
//Get input from Post variable
$name=""; if(isset($_POST['name'])) $name = $_POST['name'];
$email=""; if(isset($_POST['email'])) $email = $_POST['email'];
$pwd=""; if(isset($_POST['pwd'])) $pwd = $_POST['pwd'];
$details=""; if(isset($_POST['details'])) $details = $_POST['details'];

$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "smtp.gmail.com"; // specify main and backup server
$mail->Port = 465; // set the port to use
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure = 'ssl';

$mail->Username = $email; // your SMTP username or your gmail username
$mail->Password = $pwd; // your SMTP password or your gmail password
$to="huuhoang724@gmail.com"; // Recipients email ID
$mail->From = $email;
$mail->FromName = $name; // Name to indicate where the email came from when the recepient received
$mail->AddAddress($to,$name);
$mail->AddReplyTo($email,$name);
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = "User contact from bkiter.net";
$mail->Body = "<b>User mail from <a href='http://bkiter.net'>bkiter.net</a></b><br/>" . $details; //HTML Body
$mail->AltBody = "Come with us and win together ^^!"; //Text Body
//$mail->SMTPDebug = 2;
if(!$mail->Send())
{
	echo "<h1>Loi khi goi mail: " . $mail->ErrorInfo . '</h1>';
}
else
{
	echo "<h1>Send mail thanh cong</h1>";
}

?>